//
//  goodsTableViewCell.m
//  随便点
//
//  Created by MWJ on 15/3/25.
//  Copyright (c) 2015年 qfsoft. All rights reserved.
//

#import "goodsTableViewCell.h"
#import "xiugaiViewController.h"
#import "AppDelegate.h"
#import "goodsViewController.h"

@implementation goodsTableViewCell{
    AppDelegate *delegate;
    NSString *str;
    NSString *str1;
    NSString *str2;
    NSMutableArray *array;
}

- (void)awakeFromNib {
    delegate  = (AppDelegate *)[[UIApplication sharedApplication]delegate];
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (IBAction)sz:(id)sender {
    str = @"http://www.51anys.com:8080/waimaiwang/user/setDefault/";
    str1 = self.ID;
    str2 = [NSString stringWithFormat:@"%@%@",str,str1];
    NSURL *url=[NSURL URLWithString:str2];
    NSMutableURLRequest *request=[NSMutableURLRequest requestWithURL:url];
    NSString *postStr=@"";
    [request setHTTPMethod:@"post"];
    NSData *data=[postStr dataUsingEncoding:NSUTF8StringEncoding];
    [request setHTTPBody:data];
    [NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError){
        array =[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:nil];
        [self performSelectorOnMainThread:@selector(refreshData) withObject:array waitUntilDone:YES];
    [self.shezhi setTitleColor:[UIColor grayColor] forState:0];
        
    }];
}



-(void)refreshData{
    
}
- (IBAction)gai:(id)sender {
    [delegate haveView];
    UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    xiugaiViewController *xg = [sb instantiateViewControllerWithIdentifier:@"xgVC"];
    xg.goodsID = self.ID;
    [delegate.haveView pushViewController:xg animated:YES];
    
}
@end
